import torch

print(torch.__version__)
x = torch.arange(12)
print(x)
print(x.shape)
x = torch.arange(3 * 4 * 5)
print(x)
x = x.reshape(3, 4, 5)
print(x)
print(x.numel())

x = torch.arange(12)
X = x.reshape(3, 4)
print(X)
X = x.reshape(-1, 4)
X = x.reshape(3, -1)
X = x.reshape(2, -1)
print(X)
torch.zeros((2, 3, 4))
torch.ones((2, 3, 4))

a = torch.arange(3).reshape((3, 1))
b = torch.arange(2).reshape((1, 2))
print(a, b)
# 最终形成3*2矩阵
# [[0,0],[1,1],[2,2]]
# [[0,1],[0,1],[0,1]]
# [[0,1],[1,2],[2,3]]
print(a + b)

X = torch.arange(12, dtype=torch.float32).reshape((3, 4))
print(X)
